package com.ruoyi.industry.controller.pc;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.industry.domain.*;
import com.ruoyi.industry.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 空间发布Controller
 *
 * @author MagicCube
 * @date 2023-05-08
 */
@RestController
@RequestMapping("/frontend/release")
public class SpaceReleaseController extends BaseController {

    /*楼宇*/
    @Autowired
    private IProjectBuildingService projectBuildingService;
    /*仓库*/
    @Autowired
    private IProjectWarehouseService projectWarehouseService;
    /*厂房*/
    @Autowired
    private IProjectWorkshopService projectWorkshopService;
    /*公寓*/
    @Autowired
    private IProjectApartmentService projectApartmentService;
    /*拍卖*/
    @Autowired
    private IProjectAuctionService projectAuctionService;
    /*土地*/
    @Autowired
    private IProjectLandService projectLandService;
    /*园区*/
    @Autowired
    private IProjectParkService projectParkService;

    /**
     * 发布园区
     * @param projectPark 园区信息
     * @return 结果
     */
    @PostMapping("/addPark")
    public AjaxResult addPark(ProjectPark projectPark){
        return AjaxResult.success();
    }

    /**
     * 发布楼宇
     * @param projectBuilding 楼宇信息
     * @return 结果
     */
    @PostMapping("/addBuilding")
    public AjaxResult addBuilding(ProjectBuilding projectBuilding){
        return toAjax(projectBuildingService.insertProjectBuilding(projectBuilding));
    }

    /**
     * 发布仓库
     * @param projectWarehouse 仓库信息
     * @return 结果
     */
    @PostMapping("/addWarehouse")
    public AjaxResult addWarehouse(ProjectWarehouse projectWarehouse){
        return toAjax(projectWarehouseService.insertProjectWarehouse(projectWarehouse));
    }

    /**
     * 发布厂房
     * @param projectWorkshop 厂房信息
     * @return 结果
     */
    @PostMapping("/addWorkshop")
    public AjaxResult addWorkshop(ProjectWorkshop projectWorkshop){
        return toAjax(projectWorkshopService.insertProjectWorkshop(projectWorkshop));
    }

    /**
     * 发布公寓
     * @param projectApartment 公寓信息
     * @return 结果
     */
    @PostMapping("/addApartment")
    public AjaxResult addApartment(ProjectApartment projectApartment){
        return toAjax(projectApartmentService.insertProjectApartment(projectApartment));
    }

    /**
     * 添加拍卖
     * @param projectAuction 拍卖信息
     * @return 结果
     */
    @PostMapping("/addAuction")
    public AjaxResult addAuction (ProjectAuction projectAuction){
        return toAjax(projectAuctionService.insertProjectAuction(projectAuction));
    }

    /**
     * 发布土地
     * @param projectLand 土地信息
     * @return 结果
     */
    @PostMapping("/addLand")
    public AjaxResult addLand (ProjectLand projectLand){
        return toAjax(projectLandService.insertProjectLand(projectLand));
    }

}
